package com.exercise.poly_.detail_;
//instanceof比较操作符，用于判断对象运行类型是否为xx类型或xx类型的子类型
public class PolyDetail03 {
    public static void main(String[] args) {
        B b = new B();
        System.out.println(b instanceof B);//true
        System.out.println(b instanceof A);//true

        A a = new B();
        System.out.println(a instanceof A);//true
        System.out.println(a instanceof B);//true
        Object obj = "hello";
        String objstr = (String) obj;
        System.out.println(objstr);

    }
}
class A{
}
class B extends A{
}
